home *** CD-ROM | disk | FTP | other *** search
/ Dr. Windows 3 / dr win3.zip / dr win3 / VISUALBA / DATAEX.ZIP / DATASAMP.BAS < prev    next >
BASIC Source File  |  1993-07-06  |  2KB  |  75 lines

  1. Option Explicit
  2.  
  3. Global Const FRAME_SIZE = 3
  4.  
  5. Sub LoadFrame ()
  6.     Dim lname As Variant, class As Variant
  7.     Dim r As Integer, c As Integer, temp As Integer
  8.     Dim Breakout As Integer
  9.     Dim C1Width As Integer, C2Width As Integer
  10.     
  11.     Const DELTA = 125
  12.  
  13.     On Error Resume Next
  14.  
  15.     'Establish a size for the grid.
  16.     Form2.Grid1.Rows = FRAME_SIZE + 1
  17.     Form2.Grid1.ColWidth(1) = 1365
  18.     Form2.Grid1.ColWidth(2) = 1500
  19.  
  20.     'Clear out the current grid contents.
  21.     For r = 1 To FRAME_SIZE
  22.         Form2.Grid1.Row = r
  23.         'Hit all three columns.
  24.         For c = 0 To 2
  25.             Form2.Grid1.Col = c
  26.             Form2.Grid1.Text = ""
  27.         Next c
  28.     Next r
  29.  
  30.     'Set the column headings
  31.     Form2.Grid1.Row = 0
  32.     Form2.Grid1.Col = 1
  33.     Form2.Grid1.Text = form1.Data1.Recordset.Fields("Name").Name
  34.     Form2.Grid1.Col = 2
  35.     Form2.Grid1.Text = form1.Data1.Recordset.Fields("class").Name
  36.     
  37.     For r = 1 To FRAME_SIZE
  38.         Form2.Grid1.Row = r
  39.         
  40.         'Get student ID#
  41.         Form2.Grid1.Col = 0
  42.         Form2.Grid1.Text = form1.Data1.Recordset!Scount
  43.         
  44.         'Get  name
  45.         Form2.Grid1.Col = 1
  46.         lname = form1.Data1.Recordset!Name
  47.         Form2.Grid1.Text = lname
  48.  
  49.         'Get class
  50.         Form2.Grid1.Col = 2
  51.         class = form1.Data1.Recordset!class
  52.         Form2.Grid1.Text = class
  53.         
  54.         'If it's not the last iteration of this loop, attempt to
  55.         'move to the next record. If an error occurs, the program
  56.         'will leave this loop.
  57.         If r <> FRAME_SIZE Then
  58.             form1.Data1.Recordset.MoveNext
  59.             If form1.Data1.Recordset.EOF Then
  60.                 Exit For
  61.             End If
  62.         End If
  63.         
  64.     Next r
  65.  
  66.     'These constants, arrived at experimentally, size the
  67.     'grid box appropriately.
  68.     Const G_HEIGHT = 60
  69.     Const G_WIDTH = 310
  70.     
  71.     Form2.Grid1.Height = (FRAME_SIZE + 1) * (Form2.Grid1.RowHeight(1) + G_HEIGHT)
  72.     
  73. End Sub
  74.  
  75.